<template>
  <el-form class="right-event-repost">
    <input-normal label="转发博文mid" v-model="wbData.mid" @change="onUpdateWbComponent"></input-normal>
    <input-normal type="number" label="每天每个用户限制数" v-model="wbData.day_limit"  @change="onUpdateWbComponent"></input-normal>
    <p class="red margin-left-right-16">如果组件添加博文组事件，该值为空</p>
    <el-divider content-position="center">分享内容设置</el-divider>
    <switch-normal v-model="wbAttr.isRandom" label="多博文随机分享" @change="onChangeWbAttr"></switch-normal>
    <div v-if="wbAttr.isRandom" class="margin-left-right-16">
      <el-button type="primary"  @click.stop="onAddWbItem" class="margin-bottom-10"><el-icon><i class="jy-icon-plus"></i></el-icon>增加内容</el-button>
      <el-collapse v-model="activeNames">
        <el-collapse-item v-for="(item, index) in eventWbLists" :name="index+1" :key="index">
            <template #title>
            随机内容{{index+1}}<i class="jy-icon-delete el-collapse-item__arrow" @click.stop="onDeleteWbItem($event, index)"></i>
          </template>
          <textarea-normal class="margin-top-10" label="" placeholder="请在此处输入要分享的预设转发内容" v-model="item.text" @change="onUpdateWbItem(index)"></textarea-normal>
        </el-collapse-item>
      </el-collapse>
    </div>
    <textarea-normal v-else label="预设转发内容" placeholder="请在此处输入要分享的预设转发内容" v-model="eventWbLists[0].text" @change="onUpdateWbItem(0)"></textarea-normal>
  </el-form>
</template>

<script>
import InputNormal from '@/views/components/edit/InputNormal.vue'
import TextareaNormal from '@/views/components/edit/TextareaNormal.vue'
import SwitchNormal from '@/views/components/edit/SwitchNormal.vue'

import { addUtils } from "@/views/js/add-utils"

  export default {
    mixins: [addUtils],
    components: {
      InputNormal,
      TextareaNormal,
      SwitchNormal,
    },
  }
</script>